package swingOutput;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Container;
import java.awt.Graphics;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;

import javax.swing.JFrame;

import map.Map;

public class Frame extends JFrame implements WindowListener{
	private MainPanel _mPanel;
	
	public Frame(Map map) {
		//set layout manager
		setLayout(new BorderLayout());
		
		_mPanel = new MainPanel(map);
		Container c = getContentPane();
		c.add(_mPanel, BorderLayout.CENTER);
		addWindowListener(this);
	}

	@Override
	public void windowOpened(WindowEvent e) {
		_mPanel.repaintFrame();
		repaint();
	}

	@Override
	public void windowClosing(WindowEvent e) {
		_mPanel.stopRepainting();
		
	}

	@Override
	public void windowClosed(WindowEvent e) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void windowIconified(WindowEvent e) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void windowDeiconified(WindowEvent e) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void windowActivated(WindowEvent e) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void windowDeactivated(WindowEvent e) {
		// TODO Auto-generated method stub
		
	}
}
